package com.foreveross.proxyip.core.zk.task;

import org.apache.log4j.Logger;

import com.foreveross.proxyip.core.pools.AvailablePool;


public class ZkTaskFactory {

	protected static final Logger log =  Logger.getLogger(ZkTaskFactory.class);
	
	static ZkTaskFactory instance = null;
	
	private ZkTaskFactory(){
		
	}
	ZkTask task = null;
	
	public static ZkTaskFactory getInstance(){
		if(instance==null){
			instance = new ZkTaskFactory();
		}
		return instance;
	}
	public ZkTask getTask(String strategy) throws Exception{
		try{
		return (ZkTask)Class.forName("com.foreveross.proxyip.core.zk.task.strategy."+strategy).newInstance();
		}catch (Exception e) {
			log.error(strategy + " newInstance error");
			throw new RuntimeException(e);
		}
	}
	
}
